﻿using System.Collections.Generic;
using System.Web.Mvc;

namespace BoneSystem.Extensions.TabControll
{
    public class TabControlLayout : Component
    {

        public TabControlLayout()
        {
            TabPages = new List<TabPageControl>();
        }
        public IList<TabPageControl> TabPages { get; set; }
        
        public override MvcHtmlString GetHtmlString()
        {
            return new MvcHtmlString(GetTag().ToString(TagRenderMode.Normal));
        }

        internal override AngularTag GetTag()
        {
            var divTab = new AngularTag("div");
            divTab.Attributes["class"] = "tab-content";
            foreach (var tabPage in TabPages)
            {
                divTab.InnerHtml += tabPage.GetHtmlString().ToHtmlString();
            }
            return divTab;
        }
    }
}
